package edu.sctu.practice.class02.hujie.cgs.practice02.test24;

/**
 * Created by user14 on 2015/11/10.
 */
public abstract class Role {
//姓名，年龄，性别等成员变量,要求尽可能隐藏所有变量(能够私有就私有,能够保护就不要公有)

    protected String name;
    protected int age;
    protected boolean gender;

    //通过GetXXX()和SetXXX()方法对各变量进行读写
    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void setGender(boolean gender) {
        this.gender = gender;
    }

    public boolean getGender() {
        return gender;
    }

    //抽象的play()方法，该方法不返回任何值，
    public abstract void play();

    //同时至少定义两个构造方法。
    Role() {
        gender = true;
    }

    Role(String name, int age, boolean gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

}
